package com.dingyx.ps.util;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
public enum ChnlNoEnum {
    pingan("平安银行", "04100001001"),
    zhaoshang("招商银行", "03080001000"),
    guangda("光大银行", "03030001001"),
    minsheng("民生银行", "03050001001"),
    chuxu("邮储银行", "01000001000"),
    jianshe("建设银行", "01050001001"),
    beijing("北京银行", "04030001001"),
    pufa("浦发银行", "03100001001"),
    shanghai("上海银行", "04010001002"),
    zhongxin("中信银行", "03020001001"),
    ningbo("宁波银行", "04080001001"),
    qingdao("青岛银行", "04500001002"),
    ;

    // 成员变量
    private String bankName;
    private String bankCode;
    // 构造方法
    ChnlNoEnum(String name, String bankCode) {
        this.bankName = name;
        this.bankCode = bankCode;
    }

    /**
     * 确认编码是否符合标准
     * @param bankCode
     * @return
     */
    public static final boolean confirmBankCode(String bankCode){
        ChnlNoEnum[] chnlNoEnums = ChnlNoEnum.values();
        ChnlNoEnum chnlNoEnum = Arrays.asList(chnlNoEnums).stream().
                filter(b -> b.bankCode.equalsIgnoreCase(bankCode)).
                findAny().orElse(null);
        return Objects.isNull(chnlNoEnum);
    }
}
